package com.xgimi.open.skill.datamanager.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.xgimi.commons.base.Result;
import com.xgimi.open.skill.datamanager.biz.service.SkillVersionBizService;
import com.xgimi.open.skill.datamanager.service.api.SkillVersionRpcService;
import com.xgimi.open.skill.datamanager.service.request.SkillVersionReqDTO;
import com.xgimi.open.skill.datamanager.service.response.SkillPublishRespDTO;
import com.xgimi.open.skill.datamanager.service.response.SkillVersionRespDTO;
import com.xgimi.open.skill.datamanager.service.response.page.PageResult;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author coderzpw.zhang
 * @version 1.0
 * @description 描述
 * @date 2023/3/3 14:25
 */
@Service
public class SkillVersionRpcServiceImpl implements SkillVersionRpcService {

    @Autowired
    private SkillVersionBizService skillVersionBizService;

    @Override
    public Result<SkillPublishRespDTO> publishSkillVersion(SkillVersionReqDTO skillVersionReqDTO) {
        SkillPublishRespDTO ret = skillVersionBizService.publishSkillVersion(skillVersionReqDTO);
        return new Result<>(ret);
    }


    @Override
    public Result<PageResult<SkillVersionRespDTO>> publishedList(SkillVersionReqDTO skillVersionReqDTO) {
        PageResult<SkillVersionRespDTO> result = skillVersionBizService.publishedList(skillVersionReqDTO);
        return new Result<>(result);
    }


    @Override
    public Result<SkillVersionRespDTO> queryById(SkillVersionReqDTO skillVersionReqDTO) {
        SkillVersionRespDTO result = skillVersionBizService.queryById(skillVersionReqDTO);
        return new Result<>(result);
    }

    @Override
    public Result<SkillVersionRespDTO> getTestSkillVersion(Long skillId) {
        SkillVersionRespDTO result = skillVersionBizService.getTestSkillVersion(skillId);
        return new Result<>(result);
    }

    @Override
    public Result<SkillVersionRespDTO> getPublishedMaxVersion(Long skillId) {
        SkillVersionRespDTO result = skillVersionBizService.getPublishedMaxVersion(skillId);
        return new Result<>(result);
    }

    @Override
    public Result<SkillVersionRespDTO> getTestSkillVersion(String skillBusinessId) {
        SkillVersionRespDTO result = skillVersionBizService.getTestSkillVersion(skillBusinessId);
        return new Result<>(result);
    }

    @Override
    public Result<SkillVersionRespDTO> getPublishedMaxVersion(String skillBusinessId) {
        SkillVersionRespDTO result = skillVersionBizService.getPublishedMaxVersion(skillBusinessId);
        return new Result<>(result);
    }

    @Override
    public Result<Boolean> delete(SkillVersionReqDTO skillVersionReqDTO) {
        Boolean ret = skillVersionBizService.deleteSkillVersion(skillVersionReqDTO);
        return new Result<>(ret);
    }
}
